package com.hlxy.fixdb.utils;

public class CodeUtil {
    /**
     * 转换因子
     */
    private static final int FACTOR = 100;
    /**
     * 移位位数
     */
    private static final int MOVE_BIT = 10;
    /**
     * 固定常量
     */
    private static final int FIX_BIT = 0x1FFF;
    /**
     * 分区后缀
     */
    private static final String SUFFIX = "00";

    public static String areaCode(Long orgId) {
        long val = (orgId >> MOVE_BIT) & FIX_BIT;
        return String.valueOf(val / FACTOR) + SUFFIX;
    }
}
